<?php
/**
* Auth item assignment form class file.
*
* @author Christoffer Niska <cniska@live.com>
* @copyright Copyright &copy; 2010 Christoffer Niska
* @since 0.9
*/
class AssignmentForm extends CFormModel
{
	public $itemname;

	/**
	 * Declares the validation rules.
	 */
	public function rules()
	{
		return array(
			array('itemname', 'safe'),
		);
	}

	/**
	 * Declares attribute labels.
	 */
	public function attributeLabels()
	{
		return array(
			'itemname' => Rights::t('core', 'Authorization item'),
		);
	}
	public static function getListRoles()
	{
		
        $connect = Yii::app()->db;
		$query = "select name,description from AuthItem where type =2 and description is not null" ;
		$command = $connect->createCommand($query);
		$result=$command->queryAll();
                
		
                $roles = array();

                foreach($result as $r)

                {

                        $roles[$r['name']] = $r['description'];

                }
                return $roles;

	}
}
